/*
 * @Author: your name
 * @Date: 2021-12-16 16:20:00
 * @LastEditTime: 2021-12-16 17:00:30
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day8vue3\my-app\src\utils\Debounce.js
 */

export const debounce=(timeout, fn)=>{
    let time = null
    return function (...arg) {
        if(time){
            clearTimeout(time)
        }
        time = setTimeout(() => {
            fn.apply(this, arg)
        }, timeout)
    }
}